bleh
[mqlkit.git] / indicators / Meta COT Index.mq4
blob8b8295bf9ec2033e276315fa8197111928ba1eee
1 //+------------------------------------------------------------------+
2 //|                                               Meta COT Index.mq4 |
3 //|   Copyright  2009, C-4 (Vasiliy Sokolov, Russia, St.-Petersburg,|
4 //|                                      2009), All Rights Reserved. |
5 //|                                                   vs-box@mail.ru |
6 //+------------------------------------------------------------------+
8 //   COT-Index
10 #property copyright "Copyright  2009, C-4 (Vasiliy Sokolov, SPb), All Rights Reserved."
11 #property link      "vs-box@mail.ru"
13 #property indicator_separate_window
14 #property  indicator_buffers 4
15 #property  indicator_color1  Green
16 #property  indicator_color2  Blue
17 #property  indicator_color3  Red
18 #property  indicator_color4  Silver
20 extern int  period=156;
21 int movement_index=6;
22 extern bool Show_iNoncomm=false;
23 extern bool Show_iOperators=true;
24 extern bool Show_iNonrep=false;
25 extern bool Show_iOI=true;
27 double i_open_interest[];
28 double i_noncomm[];
29 double i_operators[];
30 double i_nonrep[];
32 #include <cotlib.mq4>
34 int init()
36    if(init_data()==false)error=true;
37    if(error==false)load_data();
38    if(error==false)count_data();
39    //if(error==false)count_index(period);
40    SetParam();
43 int start()
45    if(error==true)Print("   .   ");
46    DrowData();
49 void SetParam()
51    SetIndexStyle(0,DRAW_LINE,0,2);
52    SetIndexStyle(1,DRAW_LINE,0,2);
53    SetIndexStyle(2,DRAW_LINE,0,2);
54    SetIndexStyle(3,DRAW_LINE,0,2);
55    IndicatorDigits(2);
56    SetIndexEmptyValue(0,EMPTY_VALUE);
57    SetIndexEmptyValue(1,EMPTY_VALUE);
58    SetIndexEmptyValue(2,EMPTY_VALUE);
59    SetIndexEmptyValue(3,EMPTY_VALUE);
60    SetLevelValue(0,0.0);
61    SetLevelValue(1,20.0);
62    SetLevelValue(2,80.0);
63    SetLevelValue(3,100.0);
64    SetLevelStyle(0,0,Black);
65    //SetLevelStyle(0,1,Black);
66    //SetLevelStyle(0,1,Black);
67    //SetLevelStyle(0,1,Black);
68    if(load_cot_file==true)IndicatorShortName(StringConcatenate("Meta COT Index (",period,"): ",str_trim(cot_file)));
69    else IndicatorShortName(StringConcatenate("Meta COT Index (",period,"): ",name));
70    if(Show_iOI==true){
71       SetIndexBuffer(0,i_open_interest);
72       SetIndexLabel(0, "Open Interest");
73    }
74    if(Show_iNoncomm==true){
75       SetIndexBuffer(1,i_noncomm);
76       SetIndexLabel(1,"Index Noncommercial");
77    }
78    if(Show_iOperators==true){
79       SetIndexBuffer(2,i_operators);
80       SetIndexLabel(2,"Index Operators");
81    } 
82    if(Show_iNonrep==true){
83       SetIndexBuffer(3,i_nonrep);
84       SetIndexLabel(3,"Index Nonreportable");
85    }
88 void DrowData()
90    int end_data=get_lastdata();
91    for(int i=0;i<end_data;i++){
92       if(Show_iOI)i_open_interest[i]=get_data(INDEX_OI, i);
93       if(Show_iNoncomm)i_noncomm[i]=get_data(INDEX_NONCOMM, i);
94       if(Show_iOperators)i_operators[i]=get_data(INDEX_OPERATORS, i);
95       if(Show_iNonrep)i_nonrep[i]=get_data(INDEX_NONREP,i);
96    }